Categories
move
inventory
condition
redstone
branch
logic
arithmetic
relations
text
stack
control
misc
Contents
move
'forward', 'back', 'down', 'up' will move turtle in one direction until new tag is found.
'pushPostamble(function)' will make argument execute after any code from tag. Previous value is saved and can be restored with 'popPostamble'
Name | Icon & color | Label | Comment |
start | double-forward | Start | Optional marker for start |
Contents: | pushPostamble(forward) |
Description: | Functionally identical to 'postamble-forward', but with different color to mark start |
forward | forward | Forward | Stops on new tag |
Contents: | forward() |
back | forward | Back | Stops on new tag |
Contents: | back() |
up | forward | Up | Stops on new tag |
Contents: | up() |
down | forward | Down | Stops on new tag |
Contents: | down() |
go-right | right | Go right | Turn and make single step |
Contents: | turnRight() t.forward() |
go-left | left | Go left | Turn and make single step |
Contents: | turnLeft() t.forward() |
turn-right | right | Turn right | |
Contents: | turnRight() |
turn-left | left | Turn left | |
Contents: | turnLeft() |
step-forward | forward | Single step forward | |
Contents: | t.forward() |
step-back | forward | Single step back | |
Contents: | t.back() |
step-up | forward | Single step up | |
Contents: | t.up() |
step-down | forward | Single step down | |
Contents: | t.down() |
postamble-forward | double-forward | Default move: forward | Call 'forward' after command from tag is executed |
Contents: | pushPostamble(forward) |
postamble-back | double-forward | Default move: back | Call 'back' after command from tag is executed |
Contents: | pushPostamble(back) |
postamble-up | double-forward | Default move: up | Call 'up' after command from tag is executed |
Contents: | pushPostamble(up) |
postamble-down | double-forward | Default move: down | Call 'down' after command from tag is executed |
Contents: | pushPostamble(down) |
orient-front | orient-front | Orient front | Rotate turtle until tag is in front |
Contents: | orient('front') |
orient-right | orient-right | Orient right | Rotate turtle until tag is on the right side |
Contents: | orient('right') |
orient-left | orient-left | Orient left | Rotate turtle until tag is on the left side |
Contents: | orient('left') |
orient-back | orient-back | Orient back | Rotate turtle until tag is on back |
Contents: | orient('back') |
rotate-to-arg | rotate-cw | Rotate to argument | Pop direction and rotate |
Contents: | rotate(pop()) |
move-to-arg | dir | Move in direction | Start moving into direction passed on stack |
Contents: | replacePostamble(pop()) |
inventory
Functions like 'suck' or 'drop' will automatically try to pick proper inventory - either rotate turtle, so he is facing tag or call ...Up/..Down versions of command.
Second argument of those functions is boolean, describing if turtle should restore its initial orientation
Name | Icon & color | Label | Comment |
refuel | energy | Refuel | Will suck from inventory in tagged block |
Contents: | suck(tagDir, true) refuel() |
suck | out | Suck | |
Contents: | suck(tagDir, true) |
drop | in | Drop | |
Contents: | drop(tagDir, true) |
place | in | Place | Place block in front of turtle |
Contents: | t.place() |
first-slot | first | Select first slot | |
Contents: | _slot = 1 select(_slot) |
last-slot | last | Select last slot | |
Contents: | _slot = 16 select(_slot) |
next-slot | next | Select next slot | |
Contents: | _slot = math.min(_slot + 1, 16) select(_slot) |
prev-slot | prev | Select previous slot | |
Contents: | _slot = math.max(_slot - 1, 1) select(_slot) |
push-slot | push | Push current slot | |
Contents: | push(_slot) |
pop-slot | pop | Select slot from stack | |
Contents: | _slot = pop() select(_slot) |
item-count | question | Get item count in slot | |
Contents: | push(getItemCount(pop())) |
item-count-current | question | Get item count in current slot | |
Contents: | push(getItemCount(_slot)) |
condition
Commands in this category will push result onto argument stack. 'compare' and 'detect' operate on block with tag (see notes for 'inventory')
Name | Icon & color | Label | Comment |
compare | question | Compare | Result on stack |
Contents: | push(compare(tagDir, true)) |
detect | question | Detect | Result on stack |
Contents: | push(detect(tagDir, true)) |
redstone
Commands in this category will push result onto argument stack
Name | Icon & color | Label | Comment |
redstone-get | dust | Read redstone | Result on stack |
Contents: | push(redstone.getAnalogInput(tagDir)) |
redstone-set-analog | dust | Set redstone output (analog) | Argument on stack |
Contents: | redstone.setAnalogOutput(pop()) |
redstone-set-digital | dust | Set redstone output (digital) | Argument on stack |
Contents: | redstone.setOutput(pop()) |
push-redstone-dir | push | Push signal dir | Push redstone signal directions |
Contents: | push(scanRedstone()) |
redstone-wait | hourglass | Wait for redstone | Wait for any redstone event |
Contents: | os.pullEvent('redstone') |
redstone-wait-dir | hourglass | Wait for redstone (sided) | Wait for redstone signal from tag side |
Contents: | waitForRedstone(tagDir) |
redstone-read-top | push | Read top signal | Wait for redstone signal from tag side |
Contents: | push(rs.getInput('top')) |
branch
Commands in this category use argument stack. Helper function 'cond(function, ...)' is equivalent to 'if pop() then function(...) end'
Name | Icon & color | Label | Comment |
branch-left | branch | Conditional left | Condition on stack |
Contents: | cond(turnLeft) |
branch-right | branch | Conditional right | Condition on stack |
Contents: | cond(turnRight) |
branch-stop | branch | Conditional stop | Condition on stack |
Contents: | if pop() then stop() return end |
branch-skip | branch | Conditional skip next command | Condition on stack |
Contents: | cond(control.skip()) |
junction | branch | Junction | Turn left on true, right on false |
Contents: | if pop() then turnRight() else turnLeft() end |
logic
Functions in this category operate on argument stack (pop needed arguments and push result back). For example: 'and_()' == 'push(pop() and pop())'
Name | Icon & color | Label | Comment |
and | text!and | Logical and | Arguments on stack |
Contents: | and_() |
or | text!or | Logical or | Arguments on stack |
Contents: | or_() |
not | text!not | Logical not | Argument on stack |
Contents: | not_() |
arithmetic
Functions in this category operate on argument stack (pop needed arguments and push result back)
Name | Icon & color | Label | Comment |
zero | dni-zero | Push zero | |
Contents: | push(0) |
one | dni-one | Push one | |
Contents: | push(1) |
two | dni-two | Push two | |
Contents: | push(2) |
three | dni-three | Push three | |
Contents: | push(3) |
four | dni-four | Push four | |
Contents: | push(4) |
add | text!add | Add | Arguments on stack |
Contents: | add() |
sub | text!sub | Subtract | Arguments on stack |
Contents: | sub() |
mul | text!mul | Muliply | Arguments on stack |
Contents: | mul() |
div | text!div | Divide | Arguments on stack |
Contents: | div() |
inc | text!++ | Increment | Argument on stack |
Contents: | inc() |
dec | text!-- | Decrement | Argument on stack |
Contents: | dec() |
neg | text!neg | Negate | Argument on stack |
Contents: | neg() |
relations
Name | Icon & color | Label | Comment |
gt | text!a>b | Greater than | Arguments on stack |
Contents: | gt() |
lt | text!a<b | Less than | Arguments on stack |
Contents: | lt() |
eq | text!a==b | Equal | Arguments on stack |
Contents: | eq() |
neq | text!a!=b | Not equal | Arguments on stack |
Contents: | neq() |
lt0 | text!a<0 | Less than zero | Argument on stack |
Contents: | push(pop() < 0) |
le0 | text!a<=0 | Less or equal zero | Argument on stack |
Contents: | push(pop() <= 0) |
gt0 | text!a>0 | Greater than zero | Argument on stack |
Contents: | push(pop() > 0) |
ge0 | text!a>=0 | Greater or equal zero | Argument on stack |
Contents: | push(pop() >= 0) |
eq0 | text!a==0 | Equal to zero | Argument on stack |
Contents: | push(pop() == 0) |
neq0 | text!a~=0 | Not equal to zero | Argument on stack |
Contents: | push(pop() ~= 0) |
nil | text!a == nil | Is nil? | Argument on stack |
Contents: | push(pop() == nil) |
text
Name | Icon & color | Label | Comment |
tostring | text!a->str | Convert to string | Argument on stack |
Contents: | push(tostring(pop())) |
tonumber | text!a->num | Convert to number | Argument on stack |
Contents: | push(tonumber(pop())) |
concat | text!a..b | Concatenate | Argument on stack |
Contents: | concat() |
stack
Name | Icon & color | Label | Comment |
print | question | Print | Print top of stack |
Contents: | print(top()) |
pop | pop | Pop | Pop top of stack |
Contents: | pop() |
dup | copy | Duplicate | Duplicate top of stack |
Contents: | dup() |
swap | swap | Swap | Swap top stack elements |
Contents: | swap() |
store | in | Store | Pop index and store next stack value to slot[index] |
Contents: | store(pop()) |
load | out | Load | Pop index and load value from slot[index] |
Contents: | load(pop()) |
control
Name | Icon & color | Label | Comment |
repeat | gear | Repeat | Repeat command from previously read tag |
Contents: | prev() |
repeat-times | gear | Repeat n | Repeat command from previously read tag n times (value on stack) |
Contents: | for i=0,pop() do prev() end |
postamble-prev | push | Push default: prev | Execute previous command after all tags |
Contents: | pushPostamble(prev) |
Description: | Command from previously read tag will be executed after any new one (including this) |
postamble-pop-continue | pop | Pop and call default | |
Contents: | p = popPostamble() p() |
Description: | Restore previous postamble (command executed after tag) and call current one |
postamble-pop | pop | Pop default | |
Contents: | popPostamble() |
Description: | Restore previous postamble (command executed after tag) |
postamble-disable | pause | Disable postamble | Restore with popPostamble() |
Contents: | pausePostamble() |
Description: | Temporarily disable postamble. Will repeat current postamble, since otherwise turtle would stop. |
sleep-1 | hourglass | Sleep one second | |
Contents: | sleep(1) |
sleep-0.5 | hourglass | Sleep half second | |
Contents: | sleep(0.5) |
stop | no | Stop | Stop program execution |
Contents: | stop() |
Description: | Exit 'follow' program - no more tags will be read after that. All postambles are deactivated |
record | record | Record macro | Any next command will be appended to macro |
Contents: | !record |
Description: | Any encountered tag won't be executed, but will be added to command list. Use tag with '!save' to finish |
record-execute | record | Record and execute macro | Any next command will be executed and appended to macro |
Contents: | !record_execute |
Description: | Any encountered tag will be executed, but also added to command list. Use tag with '!save' to finish |
skip-next | next | Skip next tag | Skip any next tag |
Contents: | !skip |
push-macro | push | Save macro | Recorded macro will be pushed to stack. Start recording macro with 'record' |
Contents: | !save |
Description: | Recorded macro will be pushed to stack. Use 'call' to replay. |
play-macro | play | Play macro (pop) | Plays previously recorded macro (pop value from stack) |
Contents: | pop()() |
play-keep-macro | play | Play macro (keep) | Plays previously recorded macro (keep value on stack) |
Contents: | top()() |
execute-pause | pause | Pause command execution | Restore execution with !restore |
Contents: | !pause |
execute-restore | play | Restore command execution | |
Contents: | !restore |
postamble-macro | gear | Set macro as postamble | Sets previously recorded macro as postamble |
Contents: | pushPostamble(pop()) |
reader-disable | off | Stop reading tags | |
Contents: | readTags=false |
reader-enable | on | Restore reading tags | |
Contents: | readTags=true |
missing-ignore | on | Ignore missing tags | |
Contents: | ignoreMissing=true |
missing-fail | off | Stop on missing tags | |
Contents: | ignoreMissing=false |
misc
Name | Icon & color | Label | Comment |
debug-on | question | Debug output on | |
Contents: | debug(true) |
Description: | Will print informations like stack operations |
debug-off | question | Debug output off | |
Contents: | debug(false) |
Description: | Will print informations like stack operations |
counter-inc | text!tag[]++ | Increment current tag | Increment counter for tag and push to stack |
Contents: | counters.inc(serial) |
Description: | Counters are kept on turtle, so they can't be shared. Values do not persist between runs. |
push-tag-dir | push | Push tag dir | Push current tag direction (relative to turtle) |
Contents: | push(tagDir) |